<!DOCTYPE html>
<html>

<head>
    <script>
        let base = "";
        var baseFull = '/electricmeter'
        var token = ''
        /**
         * 获取url参数
         */
        function getRequestUrl() {
            var url = location.search;
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
                }
            }
            return theRequest;
        }

        let token1 = getRequestUrl().token;
        if (token1 == "" || token1 == null) {
            token1 = window.localStorage.getItem('JmReport-Access-Token');
        }
        window.localStorage.setItem('JmReport-Access-Token', token1);
        window.parent.historyUrl = [window.location.href]
    </script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <meta name='referrer' content='no-referrer'>
    <title>在线设计</title>
    <link rel="stylesheet" href="/electricScene/resources/static/report/desreport_/corelib/cust.css">
    <link rel="stylesheet" href="/electricScene/resources/static/report/desreport_/corelib/otherBase.css">
    <link rel="stylesheet" href="/electricScene/resources/static/report/desreport_/cdn/layui/css/layui.css">
    <link rel="shortcut icon" href="/electricScene/resources/static/report/desreport_/corelib/logo.png"
        type="image/x-ico">

    <!-- vue -->
    <script type="text/javascript" src="/electricScene/resources/static/report/desreport_/cdn/vue/vue.min.js"></script>
    <script type="text/javascript"
        src="/electricScene/resources/static/report/desreport_/cdn/vue/httpVueLoader.js"></script>

    <!-- iview -->
    <link rel="stylesheet" type="text/css" href="/electricScene/resources/static/report/desreport_/cdn/iview/iview.css">
    <script type="text/javascript"
        src="/electricScene/resources/static/report/desreport_/cdn/iview/iview.min.js"></script>
    <!-- element -->
    <link rel="stylesheet" type="text/css"
        href="/electricScene/resources/static/report/desreport_/cdn/element-ui/index.min.css">
    <script type="text/javascript"
        src="/electricScene/resources/static/report/desreport_/cdn/element-ui/index.js"></script>
    <!-- axios -->
    <script src="/electricScene/resources/static/report/desreport_/cdn/axios/axios.min.js"></script>
    <script src="/electricScene/resources/static/report/desreport_/cdn/axios/qs.min.js"></script>
    <!-- core -->
    <script src="/electricScene/resources/static/report/desreport_/js/core/request.js"></script>
    <script src="/electricScene/resources/static/report/desreport_/js/core/api.js"></script>
    <!-- biz -->
    <script src="/electricScene/resources/static/report/desreport_/js/biz/manager.js"></script>
    <!-- 工具 -->
    <script type="text/javascript" src="/electricScene/resources/static/report/desreport_/js/ruoyi.js"></script>
    <script type="text/javascript" src="/electricScene/resources/static/report/desreport_/js/scroll-to.js"></script>

    <link href="/electricScene/resources/static/report/desreport_/cdn/style/easyui.min.css" rel="stylesheet"
        type="text/css" />
    <link rel="stylesheet" type="text/css"
        href="/electricScene/resources/static/report/desreport_/cdn/layui/css/layui.css" media="all">
    <script src="/electricScene/resources/static/report/desreport_/cdn/layui/layui.js"></script>
    <script src="/electricScene/resources/static/report/desreport_/cdn/cron/jquery.min.js"></script>
    <script src="/electricScene/resources/static/report/desreport_/cdn/cron/jquery.easyui.min.js"></script>

</head>

<body style="background: #ffffff" onload="load()">
    <style>
        .ivu-page,
        .ivu-page-prev,
        .ivu-page-next,
        .ivu-select-selection,
        .ivu-select-dropdown,
        .ivu-page.mini .ivu-page-options-elevator input {
            background-color: #ffffff;
            color: #515a6e;
        }

        .page {
            display: flex;
            justify-content: center;
            -webkit-box-pack: center;
        }

        .ivu-page-item {
            background-color: #ffffff;
            border: 1px solid rgba(131, 125, 125, 0.5);
        }

        .ivu-page-item-active {
            background-color: white;
            border: 1px solid #409eff;
        }

        .ivu-page-item a {
            margin: 0 6px;
            text-decoration: none;
            color: #515a6e;
        }

        .ivu-page-next a,
        .ivu-page-prev a {
            font-size: 14px;
            color: #515a6e;
        }

        .ivu-spin-fix {
            background-color: rgba(131, 125, 125, 0.5);
        }
    </style>
    <style>
        .title {
            font-size: 20px;
            color: #000000;
            text-align: center;
            line-height: 60px;
            font-weight: 500;
        }

        .ivu-layout-sider {
            transition: all .2s ease-in-out;
            position: relative;
            background: #ffffff;
        }

        .ivu-layout {
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            flex-direction: column;
            -webkit-box-flex: 1;
            flex: auto;
            background: #ffffff;
        }

        .ivu-menu-dark.ivu-menu-vertical .ivu-menu-opened .ivu-menu-submenu-title {
            background: #ffffff;
        }

        .ivu-menu-dark.ivu-menu-vertical .ivu-menu-opened {
            background: #ffffff;
        }

        .ivu-upload-list {
            display: none;
        }

        .ivu-table-tip table tbody tr td {
            background-color: #ffffff;
            color: #000000;
        }

        .ivu-select-dropdown-list .ivu-select-item-focus {
            background: none !important;
        }

        .bounce-enter-active {
            animation: bounce 0.5s;
        }

        .bounce-leave-active {
            animation: bounce 0.5s reverse;
        }

        @keyframes bounce {
            from {
                right: -35%;
            }

            to {
                right: 0;
            }
        }

        .openType-enter-active {
            animation: openType 0.5s;
        }

        .openType-leave-active {
            animation: openType 0.5s reverse;
        }

        @keyframes openType {
            from {
                left: -35%;
            }

            to {
                left: 0;
            }
        }

        .leftopenType-enter-active {
            animation: openType 0.5s;
        }

        .leftopenType-leave-active {
            animation: openType 0.5s reverse;
        }

        @keyframes leftopenType {
            from {
                margin-left: 0;
            }

            to {
                margin-left: 300px;
            }
        }
    </style>
    <div id="jurisdiction"></div>
    <div id="app">
        <Layout>
            <transition name="openType">
                <Sider breakpoint="md" collapsible :collapsed-width="78" v-model="isCollapsed" v-show="openType"
                    width="230">
                    <i-menu theme="primary" width="auto" :class="menuitemClasses" :active-name="activeName"
                        :open-names="['sub', 'sub1','sub2', 'sub3']" @on-select="onMenuSelect">
                        <Submenu name="sub">
                            <template slot="title">
                                <Icon type="ios-apps" />
                                </Icon>
                                首页
                            </template>
                            <Menu-Item name="datainfo">
                                <Icon type="md-list" />
                                </Icon>
                                <span>报表管理</span>
                            </Menu-Item>

                            <Submenu name="sub2">
                                <template slot="title">
                                    <Icon type="ios-apps" />
                                    </Icon>
                                    统计脚本管理
                                </template>
                                <Menu-Item name="scriptReport">
                                    <Icon type="ios-cog-outline"></Icon>
                                    <span>统计脚本管理</span>
                                </Menu-Item>
                                <Menu-Item name="scriptEdit">
                                    <Icon type="ios-cog-outline"></Icon>
                                    <span>统计脚本编辑</span>
                                </Menu-Item>
                            </Submenu>
                            <Submenu name="sub3">
                                <template slot="title">
                                    <Icon type="ios-apps" />
                                    </Icon>
                                    统计任务管理
                                </template>
                                <Menu-Item name="StatisticalAdministration">
                                    <Icon type="ios-cog-outline"></Icon>
                                    <span>统计任务管理</span>
                                </Menu-Item>
                                <Menu-Item name="StatisticalEdit">
                                    <Icon type="ios-cog-outline"></Icon>
                                    <span>统计任务编辑</span>
                                </Menu-Item>
                            </Submenu>

                            <Submenu name="sub1">
                                <template slot="title">
                                    <Icon type="ios-apps" />
                                    </Icon>
                                    其他配置
                                </template>
                                <Menu-Item name="basicConfig">
                                    <Icon type="md-list" />
                                    </Icon>
                                    <span>基础配置</span>
                                </Menu-Item>
                                <Menu-Item name="codeTable">
                                    <Icon type="md-list" />
                                    </Icon>
                                    <span>码表</span>
                                </Menu-Item>
                                <Menu-Item name="reportPermits">
                                    <Icon type="md-list" />
                                    </Icon>
                                    <span>报表模板权限配置</span>
                                </Menu-Item>
                            </Submenu>
                        </Submenu>
                    </i-menu>
                    <div slot="trigger"></div>
                </Sider>
            </transition>
            <transition name="leftopenType">
                <div class="ivu-tabs-bar">
                    <!-- <div class="tabOpen" @click="openSider">
                        <Icon type="md-reorder" />
                    </div> -->
                    <div v-if="menuModel =='script'" class="modelMargin">
                        <my-script></my-script>
                    </div>
                    <div v-if="menuModel =='scriptEdit'" class="modelMargin">
                        <my-scriptedit></my-scriptedit>
                    </div>
                    <div v-if="menuModel =='task'" class="modelMargin">
                        <my-component></my-component>
                    </div>
                    <div v-if="menuModel =='taskEdit'" class="modelMargin">
                        <my-taskconfig></my-taskconfig>
                    </div>
                    <div v-if="menuModel =='other'" class="modelMargin">
                    </div>
                    <div v-if="menuModel =='basicConfig'" class="modelMargin">
                        <m-base-config></m-base-config>
                    </div>
                    <div v-if="menuModel =='codeTable'" class="modelMargin">
                        <my-dictionary></my-dictionary>
                    </div>
                    <div v-if="menuModel =='codeTablePage'" class="modelMargin">
                        <my-dictionary-page></my-dictionary-page>
                    </div>
                    <div v-if="menuModel =='reportPermits'" class="modelMargin">
                        <m-report-permits></m-report-permits>
                    </div>
                    <Tabs v-if="menuModel =='list'" value="name1" style="width: 100%" @on-click="tabsClick">
                        <tab-pane icon="md-desktop" label="报表管理" name="name1" class="jimu-tab">
                            <div
                                style="display: flex;justify-content:space-between;margin-left:36px;margin-right: 38px;align-items: center;">
                                <i-button @click="createExcel" type="primary">新建报表</i-button>
                                <div class="page">
                                    <Page :total="page.total" show-total show-elevator :page-size="page.size" show-sizer
                                        @on-change="handleCurrentChange" @on-page-size-change="handleSizeChange"
                                        size="small">
                                    </Page>
                                </div>
                                <!-- <div>
                                    <i-select transfer="true" v-model="previewModel" size="small"
                                        style="width: 78px;text-align: center;">
                                        <i-option value="view" style="font-size: 10px">视图</i-option>
                                        <i-option value="list" style="font-size: 10px">列表</i-option>
                                    </i-select>
                                </div> -->
                            </div>
                            <!-- <div
                                style="display: flex;justify-content:flex-start;margin-left:36px;margin-right: 38px;align-items: center;">
                                <el-form :inline="true" :model="searchData" class="search-form-inline">
                                    <el-form-item label="报表类型：">
                                        <el-checkbox-group v-model="searchData.reportType"
                                            @change="handleCheckedCitiesChange">
                                            <el-checkbox v-for="(item,index) in reportTypeList" :label="item.id"
                                                :key="item.id">{{ item.name }}</el-checkbox>
                                        </el-checkbox-group>
                                    </el-form-item>
                                    <el-form-item label="启用状态：" style="margin-left: 20px">
                                        <el-checkbox-group v-model="searchData.enableStatu"
                                            @change="handleCheckedCitiesChange">
                                            <el-checkbox v-for="(item,index) in enableStatusList" :label="item.id"
                                                :key="item.id">{{ item.name }}</el-checkbox>
                                        </el-checkbox-group>
                                    </el-form-item>
                                </el-form>
                            </div> -->

                            <div style="display: flex;flex-wrap: wrap;" v-if="previewModel =='view'">
                                <!-- 循环开始 &ndash;&gt;-->
                                <div v-for="(item,index) in dataSource" :key="index" class="excel-view-item"
                                    @mouseenter="item.editable=true" @mouseleave="item.editable=false">

                                    <!-- 缩略图 &ndash;&gt;-->

                                    <div class="thumb"
                                        :style="{
                                        'background-image': item.thumb ?  'url(' + item.thumb  +')' : null, 
                                        'background-size':  item.thumb ?  '100% 100%' : null,  'background-position': item.thumb ? '0 0' : null}"
                                        @mousemove="mouseenterFun">
                                        <div style="width:100%;text-align: center;background: rgba(29,38,46,0.5);">
                                            <span class="item-name" style="width:100%;">{{ item.name }}</span>
                                        </div>
                                        <transition name="bounce">
                                            <div class="excel-edit-container" v-show="item.editable">
                                                <!-- <Tooltip :content="item.name" placement="left">
                                                    <span class="item-name">{{ item.name }}</span>
                                                </Tooltip> -->
                                                <a :href="getExcelEditUrl(item)" target="_parent">
                                                    设计
                                                </a>
                                                <a class="opt-show" href="javascript:void(0);" target="_parent"
                                                    @click="getExcelViewUrl(item)">
                                                    <Tooltip content="预览" placement="left">
                                                        <i class="ivu-icon ivu-icon-ios-eye-outline"
                                                            style="font-size: 16px"></i>
                                                    </Tooltip>
                                                </a>

                                                <a class="opt-show" @click="handleDelete(item)">
                                                    <Tooltip content="删除" placement="left">
                                                        <i class="ivu-icon ivu-icon-ios-trash"
                                                            style="font-size: 16px"></i>
                                                    </Tooltip>
                                                </a>

                                                <a class="opt-show" @click="handleSwitch(item)">
                                                    <Tooltip :content="item.isSwitch ? '停用' : '启用'" placement="left">
                                                        <i-switch v-model="item.isSwitch" size="small" />
                                                    </Tooltip>
                                                </a>
                                            </div>
                                        </transition>
                                    </div>
                                </div>
                                <!-- 循环结束 &ndash;&gt;-->
                            </div>
                            <div v-else style="padding: 10px 10px">

                                <i-table size="small" style="margin-top: 10px" border :columns="listColumns"
                                    :data="dataSource">
                                    <template slot-scope="{ row, index }" slot="action">
                                        <a class="opt-list-show" href="javascript:void(0);" target="_parent"
                                            @click="getExcelViewUrl(row)">
                                            <!-- <Tooltip transfer="true" content="预览" placement="top">
                                                <i class="ivu-icon ivu-icon-ios-eye-outline"
                                                    style="font-size: 19px"></i>
                                            </Tooltip> -->
                                            <i-button type="text">预览</i-button>
                                        </a>
                                        <a class="opt-list-show" :href="getExcelEditUrl(row)" target="_parent">
                                            <!-- <Tooltip transfer="true" content="编辑" placement="top">
                                                <i class="ivu-icon ivu-icon-md-create" style="font-size: 19px"></i>
                                            </Tooltip> -->
                                            <i-button type="text">编辑</i-button>
                                        </a>

                                        <a class="opt-list-show" @click="handleDelete(row)">
                                            <!-- <Tooltip transfer="true" content="删除" placement="top">
                                                <i class="ivu-icon ivu-icon-ios-trash" style="font-size: 19px"></i>
                                            </Tooltip> -->
                                            <i-button type="text">删除</i-button>
                                        </a>

                                    </template>
                                </i-table>
                            </div>
                        </tab-pane>
                    </Tabs>
                </div>
            </transition>
        </Layout>
    </div>
    <j-jurisdiction ref="jurisdiction"></j-jurisdiction>
    </div>
    <!-- vueComponents -->
    <script src="/electricScene/resources/static/report/desreport_/js/vueComponents/baseConfig.js"></script>
    <script src="/electricScene/resources/static/report/desreport_/js/vueComponents/baseCron.js"></script>
    <script src="/electricScene/resources/static/report/desreport_/js/vueComponents/selectList.js"></script>
    <script src="/electricScene/resources/static/report/desreport_/js/vueComponents/baseParameterType.js"></script>
    <script>
        var BASE_URL = "/electricScene/resources/static";
        var currentPage = new Vue({

            el: '#app',
            components: {
                'my-taskconfig': httpVueLoader("/electricScene/resources/static/report/desreport_/vueComponets/my-taskConfiguration.vue"),
                'my-component': httpVueLoader("/electricScene/resources/static/report/desreport_/vueComponets/my-component.vue"), //加载需要使用的vue文件
                'my-script': httpVueLoader("/electricScene/resources/static/report/desreport_/vueComponets/my-script.vue"),
                'my-scriptedit': httpVueLoader("/electricScene/resources/static/report/desreport_/vueComponets/my-scriptEdit.vue"),
                'm-base-config': baseConfig,
                'my-dictionary': httpVueLoader("/electricScene/resources/static/report/desreport_/vueComponets/dictionary/index.vue"),
                'my-dictionary-page': httpVueLoader("/electricScene/resources/static/report/desreport_/vueComponets/dictionary/Details_page.vue"),
                'm-report-permits': reportPermits,
            },
            data: {
                clickindex: 0,
                clickindex2: 0,
                openType: false,
                isCollapsed: false,
                token: '',//token
                name: '',
                offsetX: 0,
                designerObj: {},
                loading: true,
                showEdit: false,
                dataSource: [],
                modalTitle: "",
                page: { //分页参数
                    page: 1,
                    size: 20,
                    total: 0,
                },
                changecode: "",
                changename: "",
                menuitem: "datainfo",
                tabpan: "name1",
                userMessage: false,
                file: null,
                uploadHeader: {},
                actionUrl: "",
                previewModel: "list",//浏览方式
                listColumns: [
                    {
                        title: '报表名称',
                        key: 'name',
                        align: 'left',
                        className: 'table-background'
                    },
                    {
                        title: '操作',
                        width: 300,
                        align: 'center',
                        slot: 'action',
                        className: 'table-background',
                        fixed: 'right'
                    }
                ],//列表的列
                searchData: {
                    reportType: [1, 2, 3, 4, 5, 6],
                    enableStatu: []
                },
                reportTypeList: [
                    {
                        id: 1,
                        name: '日报表',
                    }, {
                        id: 2,
                        name: '周报表'
                    }, {
                        id: 3,
                        name: '月度报表'
                    }, {
                        id: 4,
                        name: '季度报表',
                    }, {
                        id: 5,
                        name: '年度报表',
                    }, {
                        id: 6,
                        name: '日内报表',
                    }],
                enableStatusList: [
                    {
                        id: 1,
                        name: '启用',
                    },
                    {
                        id: 2,
                        name: '停用',
                    }
                ],
                menuModel: 'list',
                activeName: 'datainfo',
                dataSourceClone: []
            },
            computed: {
                menuitemClasses: function () {
                    return [
                        'menu-item',
                        this.isCollapsed ? 'collapsed-menu' : ''
                    ]
                }
            },
            mounted: function () {
                this.token = token;
                console.log("list_mount--------------", this.token);
                this.uploadHeader = { "X-Access-Token": this.token };
                this.actionUrl = BASE_URL + "/report/putFile";
                // this.$nextTick(()=>{
                this.dataSource = [];
                this.userInfo();
                // });
            },
            methods: {
                clickBtn() {
                    alert(this.clickindex)
                    this.clickindex += 1
                    this.clickindex2 += 2
                },

                handleSizeChange(val) {
                    this.page.size = val;
                    this.loadData();
                },
                openSider() {
                    this.openType = !this.openType
                },
                handleCurrentChange(val) {
                    this.page.page = val;
                    this.loadData();
                },
                show: function () {
                },
                mouseenterFun(val) {
                    let num = Math.round(val.offsetX / 10.5)
                    if (num < 0) {
                        val.target.style.backgroundPosition = "0%"
                    } else {
                        val.target.style.backgroundPosition = 7.12286 * num + "%"
                    }
                },

                //查询用户信息并加载数据
                userInfo: function () {
                    var that = this;
                    $http.get({
                        url: api.userInfo,
                        data: {
                            token: that.token
                        },
                        success: (result) => {
                            if (result.message != null && result.message != "") {
                                if (result.message === "admin") {
                                    that.userMessage = true;
                                }
                            }
                            that.$nextTick(() => {
                                that.loadData();
                            });
                        },
                        error: (err) => {
                            that.handleSpinHide();
                        }
                    }, that)
                },
                //加载数据
                loadData: function (name) {
                    var that = this;
                    if (name != null && name != "") {
                        that.tabpan = name;
                        that.page = { page: 1, size: 20, total: 0, };
                    }
                    var url = "";
                    that.dataSource = [];
                    if (that.tabpan == "name1") {
                        url = api.excelQuery
                    } else {
                        url = api.excelQueryByTemplate
                    }
                    $http.get({
                        url: url,
                        data: {
                            pageNo: that.page.page,
                            pageSize: that.page.size,
                            reportType: that.menuitem,
                            name: that.name,
                            token: that.token
                        },
                        success: (result) => {
                            var ls = result.records;
                            that.page.total = result.total
                            if (ls && ls.length > 0) {
                                for (var i = 0; i < ls.length; i++) {
                                    //预览时设置报表打印宽度
                                    let jsonStr = ls[i].jsonStr;
                                    let width;
                                    if (jsonStr) {
                                        jsonStr = JSON.parse(jsonStr);
                                        width = jsonStr.printElWidth || jsonStr.dataRectWidth || 800;
                                        ls[i].printWidth = width;
                                    }
                                    ls[i].editable = false;
                                }
                                this.dataSourceClone = ls
                                that.$nextTick(() => {
                                    that.dataSource = JSON.parse(JSON.stringify(ls));
                                    // that.dataSource[0].isSwitch = true

                                });
                            }
                        },
                        error: (err) => {
                            that.handleSpinHide();
                        }
                    }, that)
                },
                //新建报表
                createExcel: function () {
                    var that = this;
                    $http.post({
                        url: api.saveReport,
                        data: {},
                        contentType: 'json',
                        success: (result) => {
                            //update-begin---author:wangshuai ---date:20220215  for：[issues/I4SOSH]做完的报表，预览生成的访问地址，默认都加了token=null------------
                            let url = api.index + result.id + "?menuType=" + this.menuitem;
                            window.open(this.splicRouter('index.html', result.id + "&menuType=" + this.menuitem), "_parent");
                            //update-end---author:wangshuai ---date:20220215  for：[issues/I4SOSH]做完的报表，预览生成的访问地址，默认都加了token=null------------
                        }
                    }, that)
                },
                //未使用
                handleEditConfig: function (item) {
                    window.location.href = api.index + item.id + "?token=" + this.token;
                },
                /**
                 * 为路径拼接token
                 * @param url 需要拼接的路径
                 * @return 拼接后的token
                 */
                splicingToken(url) {
                    if (this.token && "null" != this.token) {
                        if (url.indexOf("?") != -1) {
                            url = url + "&token=" + this.token;
                        } else {
                            url = url + "?token=" + this.token;
                        }
                    }
                    return url;
                },
                /**
                 * @param url 需要拼接的路径
                 * @return 拼接后的token
                 */
                splicRouter(url, query) {
                    return '/electricScene/#/report/reportExcel' + '?toPath=' + url + '&params=' + query + '&previousPage=true';
                },
                //删除报表
                handleDelete: function (item) {
                    $http.confirm({
                        title: '删除报表',
                        content: '是否确认删除?',
                        url: api.deleteReport,
                        data: {
                            id: item.id,
                            token: this.token
                        },
                        success: (result) => {
                            this.loadData();
                        }
                    }, this);
                },
                //复制模版
                handleCopy: function (item) {
                    $http.confirm({
                        title: '复制报表',
                        content: '是否确认复制?',
                        url: api.reportCopy,
                        method: 'get',
                        data: {
                            id: item.id,
                            token: this.token
                        },
                        success: (result) => {
                            this.loadData();
                        }
                    }, this);
                },
                handlerViewExcel: function (item) {
                    console.log(item)
                },
                handleSwitch: function (item) {
                    console.log(item)
                },
                getExcelEditUrl: function (item) {
                    //update-begin---author:wangshuai ---date:20220215  for：[issues/I4SOSH]做完的报表，预览生成的访问地址，默认都加了token=null------------
                    // return this.splicingToken(api.index + item.id);
                    return this.splicRouter('index.html', item.id);
                    //update-end---author:wangshuai ---date:20220215  for：[issues/I4SOSH]做完的报表，预览生成的访问地址，默认都加了token=null------------
                },
                getExcelViewUrl: async function (item) {
                    //update-begin---author:wangshuai ---date:20220215  for：[issues/I4SOSH]做完的报表，预览生成的访问地址，默认都加了token=null------------
                    // return this.splicingToken(api.view + item.id);
                    let d = await this.getReport(item)
                    let p = JSON.parse(d.params)
                    let s = `&startTime=${p?.startTime}&endTime=${p?.endTime}&reportType=${p?.reportType}&dataGrarity=${p?.dataGrarity}`
                    window.open(this.splicRouter('view.html', item.id + s), "_parent");
                    // return this.splicRouter('view.html', item.id + s);
                    //update-end---author:wangshuai ---date:20220215  for：[issues/I4SOSH]做完的报表，预览生成的访问地址，默认都加了token=null------------
                },
                getLabelText1: function (createElement) {
                    return createElement('div',
                        {
                            style: { color: '#fff' }
                        },
                        [
                            createElement('Icon', { props: { type: 'ios-checkmark' } }),
                            '模板库'
                        ]
                    )
                },
                onMenuSelect: function (name) {
                    console.log(name)
                    this.activeName = name;
                    if (name == 'editing') {
                        window.open(this.splicingToken(api.index + '0'))
                    }
                    else if (name == 'scriptReport') {
                        this.menuModel = 'script'
                    } else if (name == 'scriptEdit') {
                        this.menuModel = 'scriptEdit'
                    }
                    else if (name == 'StatisticalAdministration') {
                        this.menuModel = 'task'
                    }
                    else if (name == 'StatisticalEdit') {
                        this.menuModel = 'taskEdit'
                    }
                    else if (name == 'basicConfig') {
                        this.menuModel = 'basicConfig'
                    }
                    else if (name == 'codeTable') {
                        this.menuModel = 'codeTable'
                    }
                    else if (name == 'reportPermits') {
                        this.menuModel = 'reportPermits'
                    }
                    else {
                        this.menuModel = 'list'
                        this.menuitem = name;
                        this.page = { page: 1, size: 20, total: 0, };
                        this.dataSource = [];
                        this.name = ""
                        this.loadData();
                    }
                },
                //报表设计和模板案例点击事件
                tabsClick(name) {
                    this.name = ""
                    this.loadData(name)
                },
                //回车搜索事件
                enterSearchClick() {
                    this.loadData()
                },
                //设置取消模版
                setTemplate: function (item, arg) {
                    var content = (arg == 1) ? '是否确认设置为模板?' : '是否确认取消模板?';
                    let title = (arg == 1) ? '收藏报表' : '取消收藏报表'
                    $http.confirm({
                        title: title,
                        content: content,
                        url: api.setTemplate,
                        method: 'get',
                        data: {
                            id: item.id,
                            template: arg,
                            token: this.token
                        },
                        success: (result) => {
                            this.loadData();
                        }
                    }, this);
                },
                handleUpload(file) {
                    this.file = file;
                    return true;
                },
                handleFormatError(file) {
                    this.$Notice.warning({
                        title: '文件格式不正确',
                        desc: '文件 ' + file.name + ' 格式不正确，请上传 jpg 或 png 格式的图片。'
                    });
                },
                handleMaxSize(file) {
                    this.$Notice.warning({
                        title: '超出文件大小限制',
                        desc: '文件 ' + file.name + ' 太大，不能超过 2M。'
                    });
                },
                handleSuccess(res) {
                    if (res != null) {
                        this.$Message.success(res.message);
                        this.dataSource.forEach((item, index, array) => {
                            if (item.id === res.result.id) {
                                item.thumb = res.result.thumb;
                            }
                        })
                    }
                },
                handleSpinHide() {
                    /* setTimeout(() => {
                         this.$Spin.hide();
                     }, 3000);*/
                },
                //分享按钮点击事件
                handleShare(id) {
                    $http.get({
                        url: api.queryJurisdiction,
                        data: { reportId: id },
                        success: (result) => {
                            if (result) {
                                if (result.status == '0') {
                                    let protocol = window.location.protocol;
                                    let host = window.location.host;
                                    let url = protocol + "//" + host + base;
                                    result.previewUrl = url + result.previewUrl;
                                    this.$refs.jurisdiction.jurisdictionData = result;
                                    this.$refs.jurisdiction.shareUrlModal = true
                                } else {
                                    //update-begin---author:wangshuai ---date:20220315  for：[issues/I4WWKE]分享链接的预览密码能否忽略------------
                                    //兼容老数据没有是否显示密码的情况下;
                                    //previewLockStatus 密码锁状态(0不存在密码锁，1存在密码锁);原来取消分享后的默认应该是1
                                    if (!result.previewLockStatus) {
                                        result.previewLockStatus = "1"
                                    }
                                    //update-end---author:wangshuai ---date:20220315  for：[issues/I4WWKE]分享链接的预览密码能否忽略------------
                                    this.$refs.jurisdiction.jurisdictionData = result;
                                    this.$refs.jurisdiction.shareModal = true
                                }
                            } else {
                                this.$refs.jurisdiction.jurisdictionData.reportId = id
                                this.$refs.jurisdiction.shareModal = true
                            }
                        }
                    })
                },
                // 获取缩略图的预览地址
                getThumbSrc(item) {
                    if (!item.thumb) {
                        return "${base}" + "${customPrePath}" + "/report/desreport_/corelib/mpfang.jpg"
                    } else {
                        if (item.thumb.indexOf('http') == 0) {
                            return item.thumb
                        } else {
                            return "${base}" + "${customPrePath}" + JM_VIEW_IMG_URL + "/" + item.thumb
                        }
                    }
                },
                handleCheckedCitiesChange(value) {
                    console.log(this.searchData)
                    let a = []
                    let ls = this.dataSourceClone
                    this.searchData.reportType.forEach((item, i) => {
                        if (ls[item - 1]) {
                            a.push(ls[item - 1])
                        }
                    })

                    this.dataSource = JSON.parse(JSON.stringify(a));
                },
                getReport(item) {
                    return new Promise((resolve, reject) => {
                        $http.get({
                            url: api.getReport(item.id),
                            success: (result) => {
                                if (result) {
                                    resolve(result)
                                    // return result
                                    // let params = JSON.parse(result.params)
                                    // if (params.reportType.indexOf('月') > -1 || params.reportType.indexOf('年') > -1) {
                                    //     params['time'] = params.startTime
                                    // } else if (params.reportType.indexOf('日') > -1 || params.reportType.indexOf('自定义') > -1) {
                                    //     params['time'] = [params.startTime, params.endTime]
                                    // } else {
                                    //     params['time'] = params.startTime
                                    // }
                                    // this.designerObj = { ...this.designerObj, ...result, ...params };
                                    // xs.data.settings.reportParams = this.designerObj
                                }
                            }
                        });
                    })

                },
            }
        })
        function load() {
            let arr = [
                "jurisdiction",
            ]
            arr.forEach(item => {
                $("#" + item).load("./template/components/" + item + '.html');
            })
        }
    </script>
    <script>
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.type = 'text/javascript';
            hm.async = true;
            hm.src = "https://hm.baidu.com/hm.js?5819d05c0869771ff6e6a81cdec5b2e8";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</body>

</html>